package com.siashan.toolkit.lock4j.strategy;

import com.siashan.toolkit.lock4j.exception.LockFailureException;
import lombok.extern.slf4j.Slf4j;

/**
 * 默认锁失效策略
 *
 * @author siashan
 * @since v1.0.1
 */
@Slf4j
public class DefaultLockFailStrategy extends LockFailStrategy {

    @Override
    public void onLockFailure(String key, long acquireTimeout, int acquireCount,String lockFailMsg) {
        log.debug("thread:{} acquire lock fail,key:{} acquireTimeout:{}ms", Thread.currentThread().getName(), key,
                acquireTimeout);
        throw new LockFailureException(lockFailMsg);
    }
}
